#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include <ht_mem.h>

static pthread_mutex_t mem_metux = PTHREAD_MUTEX_INITIALIZER;

void *httc_malloc (size_t size){
	pthread_mutex_lock (&mem_metux);
	//printf ("****** Inc mem cnt: %lld\n", ++mem_cnt);
	pthread_mutex_unlock (&mem_metux);
	return malloc(size);
}
void *httc_calloc (size_t nmemb, size_t size){
	pthread_mutex_lock (&mem_metux);
	//printf ("****** Inc mem cnt: %lld\n", ++mem_cnt);
	pthread_mutex_unlock (&mem_metux);
	return calloc(nmemb, size);
}
void httc_free (void *ptr){
	pthread_mutex_lock (&mem_metux);
	//printf ("****** Dec mem cnt: %lld\n", --mem_cnt);
	pthread_mutex_unlock (&mem_metux);
	free(ptr);
}
